package kii.utils
{
	/**
	 * String convertor, class converts identificators from one Convention to another, for example camelStyle to dash-style. 
	 * @author David "Nirth" Sergey
	 * 
	 */
	public final class Conventions
	{
		/**
		 * Converts lower_dash or dash-style to camelStyle name. 
		 * @param original   Original identificator.
		 * @param delimiter  Delimiter type, default is <code>"_"</code>.
		 * @param capitilize Which word is first to capitalize, default is 2.
		 * @return           Converted identificator.
		 */
		public static function camelize(original:String, delimiter:String = '_', capitilize:int = 2):String
		{
			var parts:Array = original.split(delimiter);
			var result:String = '';
			for ( var i:int = 0; i < parts.length; i ++)
			{
				if ( i + 1 < capitilize )
					result += parts[i];
				else
					result += Strings.capitalize(parts[i]);
			}
			return result;
		}
	}
}